package com.blank.shop.sleuth.zipkin.bb;

import com.blank.shop.sleuth.zipkin.ShopSleuthZipkinAaApplication;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Profile;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * <br/>Date 2021/8/31
 * <br/>Time 17:54:33
 *
 * @author _blank
 */
@Slf4j
@Profile({ShopSleuthZipkinAaApplication.SERVER_PROFILE_AB})
@RestController
public class SleuthServerBbController {

    @Value("${server.port}")
    private Integer port;

    @Resource
    private RestTemplate restTemplate;

    @PostMapping(path = {"say-hello"})
    public ResponseEntity<String> sayHello() {
        log.info("bb当前服务端口是：{}", this.port);
        return this.restTemplate.exchange(ShopSleuthZipkinAaApplication.SERVICE_AC_URL, HttpMethod.POST, HttpEntity.EMPTY, String.class);
    }

}
